package com.ght.springboot.elasticsearch.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

/**
 * @description: 字段属性
 * @author: haitao.gao
 * @create: 2019-01-29 15:50
 **/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FieldAttribute {

    /**
     * 字段类型 TODO 5.x好像对String进行了变更
     */
    private String type;

    /**
     * 字段分词器
     */
    private String analyzer;

    /**
     * 字段是否添加到索引(是否搜索可见) true:Default false:不会被分析，搜索不到 strict:如果发现新字段必须加到Mapping中，否则报错
     */
    private String dynamic;

    /**
     * 字段搜索权重(默认为1)
     */
    private Integer boost;

    /**
     * 格式，针对日期可以（yyyy-MM-dd）
     */
    private String format;

    public FieldAttribute(String type,String analyzer,Integer boost){
        this.type = type;
        this.analyzer = analyzer;
        this.boost = boost;
    }

    public FieldAttribute(String type,String analyzer,Integer boost,String format){
        this.type = type;
        this.analyzer = analyzer;
        this.boost = boost;
        this.format = format;
    }
}
